package dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import util.HibernateBaseDao;
import entity.User;
@Repository
public class UserDao extends HibernateBaseDao<User> {
	public User findUser(String name, String password) {
		List<User> list =this.find("from User where uname=? and pwd=?", name,password);
		return (list.size()>0?(User) list.iterator().next():null) ;
	}
	public User findUser(String name) {
		List<User> list = this.find("from User where uname=? ", name);
		return (list.size()>0?(User) list.iterator().next():null) ;
	}
	public User findUser(String name,int id) {
		List<User> list = this.find("from User where uname=? and id<>?", name,id);
		return (list.size()>0?(User) list.iterator().next():null) ;
	}
}
